package pjwstk.jps.result;

import java.util.List;

/**
 * @author s9111_s10304
 *
 */
public class StructResult implements IStructResult
{
    private List<ISingleResult> elements;
    
    /**
     * @param elements
     */
    public StructResult(List<ISingleResult> elements) {
        this.elements = elements;
    }

    @Override
    public List<ISingleResult> elements() {
        return elements;
    }
    
    @Override
    public String toString() {
        String srString = "struct(";
        for (int i = 0; i < elements.size(); i++) {
            srString += i + "=" + elements.get(i).toString() + ", ";
        }
        if (7 < srString.length())
            srString = srString.substring(0, srString.length()-2); // remove last , (comma and space) added in the loop 
        srString += ")";
        return srString;
    }
}